package com.agile.leetcode.AESandRSAandMd5;



import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

/**
 * @Author KD
 * @Date 2021/1/26 10:14
 */
public class Md5ToString {
    public static void main(String[] args) throws NoSuchAlgorithmException {
        // 定义用户与密码
        String str="user:czk1994";
        // 生成
        byte[] bytes = MessageDigest.getInstance("SHA1").digest(str.getBytes());
        // 编码
        String s = Base64.getEncoder().encodeToString(bytes);
        System.out.println(s);
    }
}
